<template>
	<view class="container">
		<image src="https://cdn1.eachiing.com/static/image/user_join_2.png!origin" mode="widthFix"
			style="width: 100vw;height: 100vh;"></image>
		<view class="button" @click="toUserPage">
		</view>
		<!-- <image class="qrcode" :src="qrcode"></image> -->
	</view>

</template>

<script>
	export default {
		data() {
			return {
				// qrcode: 'https://cdn1.eachiing.com/static/image/qrcode2.png!origin'
			}
		},
		onLoad() {
			// this.getConfig()
		},
		methods: {
			getConfig() {
				this.$api.getConfig().then((res) => {
					this.qrcode = res.data.qrcode
				})
			},
			toUserPage() {
				// 跳转到指定抖音主页
				tt.openAwemeUserProfile({
					success: (res) => {

					},
					fail: (res) => {
						// 如果跳转失败则保存二维码
						uni.downloadFile({
							url: this.qrcode,
							success: (res) => {
								if (res.statusCode === 200) {
									uni.saveImageToPhotosAlbum({
										filePath: res.tempFilePath,
										success: (res) => {
											uni.showToast({
												title: '已保存到相册'
											})
										}
									})
								}
							},
							fail: (res) => {
								console.log(res)
							}
						});
					},
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100vw;
		height: 100vh;
	}

	.qrcode {
		position: absolute;
		left: 63.1%;
		bottom: 2.4%;
		background-color: #fff;
		width: 120rpx;
		height: 120rpx;
		border-radius: 50%;
	}

	.button {
		position: fixed;
		left: 50%;
		bottom: 10%;
		transform: translate(-50%, 0);
		// background-color: #000;
		opacity: 0;
		width: 70%;
		height: 150rpx;
	}
</style>
